import { createApp } from 'vue';
import App from './App.vue';
import'@/assets/styles/index.scss';
import 'default-passive-events';
import {setupStore} from "@/stores/index.js";
import {setupRouter} from "@/router/index.js";
import {
  setupElement,
  setupAssets,
  setupCustomComponents,
  setupGlobalMethods
} from '@/plugins/index.js';
import directive from '@/directive';
import i18n from "@/locales/index.js";
import '@/utils/browserPatch.js';

const app = createApp(App);
function  setupPlugins() {
  //引入静态资源
  setupAssets();
  //注册全局常用的element ui 组件
  setupElement(app);
  //注册全局自定义组件
  setupCustomComponents(app);
  //注册全局方法
  setupGlobalMethods(app, i18n);
  //注册操作按钮权限
  directive(app);
  //注册国际化
  app.use(i18n);
}
async function setupApp() {
  //初始化pinia
  setupStore(app);
  //初始化路由
  await setupRouter(app);
  app.mount('#app');
}
setupPlugins();
setupApp().then();
